Skip to content

UI: Fix listing of resources for ASG belonging to a project#13187

Open
vishesh92 wants to merge 2 commits into
apache:4.20from
shapeblue:fix-listing-for-asg-in-project
Open

UI: Fix listing of resources for ASG belonging to a project#13187
vishesh92 wants to merge 2 commits into
apache:4.20from
shapeblue:fix-listing-for-asg-in-project

Conversation

@vishesh92

Copy link
Copy Markdown
Member

Description

This PR fixes #12978

This PR resolves missing project scopes issues within the AutoScale UI components (AutoScaleVmProfile.vue, AutoScaleUpPolicyTab.vue, and AutoScaleDownPolicyTab.vue).

Generated Summary

This pull request improves the handling of project-scoped resources and enhances template name resolution in the AutoScale UI components. The main changes ensure that API requests include the projectid parameter when relevant, and that template names are accurately fetched and displayed, especially when templates may not be present in the local list.

Project-aware API requests:

  • All API calls in AutoScaleDownPolicyTab.vue, AutoScaleUpPolicyTab.vue, and AutoScaleLoadBalancing.vue now include the projectid parameter if the resource is part of a project. This ensures correct data retrieval in multi-project environments. [1] [2] [3] [4] [5] [6] [7] [8]

  • Similar updates in AutoScaleVmProfile.vue add projectid to template, VM profile, and related API requests for project-scoped resources. [1] [2] [3]

Template name resolution improvements:

  • Replaces the previous method of looking up template names from a local list with an API call (listTemplates) to fetch the template name by templateid. If the template is not found, the raw templateid is displayed as a fallback. [1] [2] [3] [4]

UI/UX enhancements:

  • After updating an AutoScale VM profile, the UI now refreshes profile data to reflect changes immediately and closes the modal dialog upon success. [1] [2] [3]
  • Prevents multiple concurrent updates by disabling the update action while loading.

These changes collectively improve the correctness and user experience of the AutoScale UI, especially for users working with project resources.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@codecov

codecov Bot commented May 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 16.26%. Comparing base (a7c2a05) to head (4210b8e).
⚠️ Report is 14 commits behind head on 4.20.

Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #13187      +/-   ##
============================================
- Coverage     16.27%   16.26%   -0.01%     
+ Complexity    13440    13436       -4     
============================================
  Files          5665     5667       +2     
  Lines        500555   500719     +164     
  Branches      60789    60804      +15     
============================================
- Hits          81445    81425      -20     
- Misses       410004   410184     +180     
- Partials       9106     9110       +4     
Flag Coverage Δ
uitests 4.14% <ø> (-0.02%) ⬇️
unittests 17.11% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +428 to +435
const params = {
listAll: true,
id: this.resource.id
}).then(response => {
}
if (this.resource.projectid) {
params.projectid = this.resource.projectid
}
api('listAutoScaleVmGroups', params).then(response => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change happens a lot. should it be a method?

@DaanHoogland DaanHoogland changed the title Fix listing of resorces for ASG belonging to a project Fix listing of resources for ASG belonging to a project May 27, 2026
@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan ui

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

UI build: ✔️
Live QA URL: https://qa.cloudstack.cloud/simulator/pr/13187 (QA-JID-941)

@weizhouapache weizhouapache changed the title Fix listing of resources for ASG belonging to a project UI: Fix listing of resources for ASG belonging to a project Jun 30, 2026

@weizhouapache weizhouapache left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lgtm

there will be some conflicts when porting to 4.22/main

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes missing project scoping in AutoScale UI components so that ASG-related resources (VM profiles, policies, LB rules) are correctly listed when the ASG belongs to a project, and improves template name display for project-scoped templates.

Changes:

  • Adds projectid to several AutoScale-related API requests when the current resource is project-scoped.
  • Updates AutoScale VM profile UI to resolve template names via listTemplates (instead of relying only on a locally loaded list).
  • Refreshes AutoScale VM profile data after updates and adjusts modal/update flow.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
ui/src/views/compute/AutoScaleVmProfile.vue Adds project-aware params, introduces template-name resolution via API, and refreshes profile data on update.
ui/src/views/compute/AutoScaleUpPolicyTab.vue Adds projectid to VM group / LB rule / policy listing calls for project-scoped ASGs.
ui/src/views/compute/AutoScaleDownPolicyTab.vue Adds projectid to VM group / LB rule / policy listing calls for project-scoped ASGs.
ui/src/views/compute/AutoScaleLoadBalancing.vue Adds projectid to LB rule and ASG listing calls under Load Balancing view.
Comments suppressed due to low confidence (1)

ui/src/views/compute/AutoScaleLoadBalancing.vue:538

  • fetchAutoScaleVMgroups flips this.loading to false in each per-rule request’s finally(), so the loading state can become false while other listAutoScaleVmGroups calls are still in flight. This makes the UI loading indicator inaccurate (especially with multiple LB rules).
    fetchAutoScaleVMgroups () {
      this.loading = true
      this.lbRules.forEach(rule => {
        const params = {
          listAll: true,
          lbruleid: rule.id
        }
        if (this.resource.projectid) {
          params.projectid = this.resource.projectid
        }
        api('listAutoScaleVmGroups', params).then(response => {
          rule.autoscalevmgroup = response.listautoscalevmgroupsresponse?.autoscalevmgroup?.[0]
        }).finally(() => {
          this.loading = false
        })
      })

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui/src/views/compute/AutoScaleVmProfile.vue Outdated
Comment thread ui/src/views/compute/AutoScaleVmProfile.vue Outdated
@vishesh92

Copy link
Copy Markdown
Member Author

@blueorangutan ui

@blueorangutan

Copy link
Copy Markdown

@vishesh92 a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

UI build: ✔️
Live QA URL: https://qa.cloudstack.cloud/simulator/pr/13187 (QA-JID-958)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI: Template name doesn't show up for AutoScale Instance Groups

6 participants